﻿namespace EFMLEditor.Internal.Validating.Attributes
{
    using System;
    using System.Reflection;
    using System.Runtime.CompilerServices;

    public class PrimitiveAttribute : ValidatingAttribute
    {
        #region Overrides of ValidatingAttribute

        public override bool Do(object inpt, ParameterInfo parameter)
        {
            bool con = Convert.GetTypeCode(inpt) != TypeCode.Object;

            if (!con)
            {
                this.Message = parameter.Name + " must be primitive";
            }

            return con;
        }

        #endregion
    }
}